package cn.hl.sfzy.service.impl;

import cn.hl.sfzy.entity.Company;
import cn.hl.sfzy.mapper.CompanyMapper;
import cn.hl.sfzy.service.CompanyService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @ClassName CompanyServiceImpl
 * @Description TOOO
 * @Author Lilysi
 * @Date 2024//10//25//17:31
 * @Version 1.0
 */
@Service
public class CompanyServiceImpl implements CompanyService {
    @Autowired
    private CompanyMapper companyMapper;

    @Override
    public int delete(Long id) {
        int delete = companyMapper.delete(id);
        return delete;
    }

    @Override
    public int update(Company company) {
        int update = companyMapper.update(company);
        return update;
    }

    @Override
    public int insert(Company company) {
        int insert = companyMapper.insert(company);
        return insert;
    }

    @Override
    public PageInfo<Company> findByPage(int pageNum, int pageSize, Company company) {
        PageHelper.startPage(pageNum, pageSize);
        PageInfo<Company> companyPageInfo = new PageInfo<>(companyMapper.select(company));
        return companyPageInfo;
    }

    @Override
    public Company find() {
        Company company = companyMapper.find();
        return company;
    }
}
